{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0dc5a164",
   "metadata": {},
   "source": [
    "## 作业 "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fafbca39",
   "metadata": {},
   "source": [
    "### \n",
    "1.随机数生成六个班的考试成绩，3门考试：Python、数学、语文。每个班50人\n",
    "\n",
    "2.将六个班的考试成绩进行合并得到score\n",
    "\n",
    "3.生成性别数组sex，水平叠加数组sex和score得到data\n",
    "\n",
    "4.分别计算男女生各科成绩统计指标：最小值、最大值、平均分、中位数、标准差 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "cb80cb32",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "1b2b863b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[14, 83, 52],\n",
       "       [60, 54, 37],\n",
       "       [32, 24, 62],\n",
       "       [55, 76, 12],\n",
       "       [80, 45, 72],\n",
       "       [24,  0, 38],\n",
       "       [49, 13, 28],\n",
       "       [91, 59, 11],\n",
       "       [90, 57, 59],\n",
       "       [67, 16, 67],\n",
       "       [29, 36, 94],\n",
       "       [55,  8, 25],\n",
       "       [82,  3, 99],\n",
       "       [57, 37, 37],\n",
       "       [ 7, 61, 92],\n",
       "       [29, 23, 34],\n",
       "       [17, 70, 84],\n",
       "       [25, 99, 84],\n",
       "       [28, 50, 36],\n",
       "       [91, 68, 37],\n",
       "       [10, 50, 37],\n",
       "       [45, 14, 61],\n",
       "       [58, 75, 70],\n",
       "       [28, 67,  8],\n",
       "       [ 0, 70, 69],\n",
       "       [17, 93, 13],\n",
       "       [21, 44, 18],\n",
       "       [ 0, 82, 41],\n",
       "       [83, 11, 10],\n",
       "       [71, 86, 18],\n",
       "       [ 0, 72, 34],\n",
       "       [20, 58, 53],\n",
       "       [41, 93, 90],\n",
       "       [90, 85, 29],\n",
       "       [11, 34, 57],\n",
       "       [55, 11, 90],\n",
       "       [24, 80, 34],\n",
       "       [52, 22, 92],\n",
       "       [15, 45,  1],\n",
       "       [89, 61, 37],\n",
       "       [47, 82, 20],\n",
       "       [44, 17, 94],\n",
       "       [50, 37, 52],\n",
       "       [15, 13, 49],\n",
       "       [ 6, 29, 13],\n",
       "       [74,  2, 62],\n",
       "       [93,  3, 52],\n",
       "       [64, 99, 91],\n",
       "       [72, 28, 10],\n",
       "       [95, 21, 55]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[14, 73, 24],\n",
       "       [81, 95, 65],\n",
       "       [82, 19, 18],\n",
       "       [18, 89, 90],\n",
       "       [99, 42, 56],\n",
       "       [41,  7, 10],\n",
       "       [64, 26, 28],\n",
       "       [13,  6,  9],\n",
       "       [55, 62, 93],\n",
       "       [91, 34,  5],\n",
       "       [19, 85, 97],\n",
       "       [99, 36, 61],\n",
       "       [48, 66, 66],\n",
       "       [71, 96, 70],\n",
       "       [62, 46, 39],\n",
       "       [11, 10, 48],\n",
       "       [69, 80, 61],\n",
       "       [67, 73, 76],\n",
       "       [74,  6, 34],\n",
       "       [70, 86, 73],\n",
       "       [36, 42, 41],\n",
       "       [28, 13, 76],\n",
       "       [36, 32, 73],\n",
       "       [ 2, 44, 70],\n",
       "       [73, 14, 98],\n",
       "       [31, 31,  1],\n",
       "       [89, 74, 12],\n",
       "       [11, 64, 27],\n",
       "       [35, 66, 87],\n",
       "       [49, 38, 50],\n",
       "       [61, 79, 34],\n",
       "       [30,  4, 13],\n",
       "       [87,  5, 46],\n",
       "       [83, 78, 85],\n",
       "       [22, 85, 25],\n",
       "       [32, 84, 91],\n",
       "       [ 4, 34, 36],\n",
       "       [95, 44, 33],\n",
       "       [27, 61, 18],\n",
       "       [98, 79, 15],\n",
       "       [69, 72, 23],\n",
       "       [36, 40, 11],\n",
       "       [85, 49, 82],\n",
       "       [ 8, 89, 44],\n",
       "       [20, 16, 92],\n",
       "       [ 1, 66, 94],\n",
       "       [54, 70, 40],\n",
       "       [50, 90, 24],\n",
       "       [44, 14, 37],\n",
       "       [20, 53, 66]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[98, 43, 94],\n",
       "       [57, 85, 46],\n",
       "       [75, 87, 26],\n",
       "       [84,  2, 10],\n",
       "       [21, 96, 78],\n",
       "       [62, 50, 97],\n",
       "       [59, 94, 43],\n",
       "       [84, 93, 70],\n",
       "       [17, 73, 37],\n",
       "       [ 9, 45, 26],\n",
       "       [40, 31,  1],\n",
       "       [ 0,  7, 55],\n",
       "       [49,  8, 65],\n",
       "       [13, 22, 73],\n",
       "       [35, 62, 25],\n",
       "       [49, 60, 41],\n",
       "       [49,  5, 72],\n",
       "       [45, 82, 75],\n",
       "       [ 6, 33, 54],\n",
       "       [96, 17, 44],\n",
       "       [ 4, 20, 78],\n",
       "       [88, 53, 99],\n",
       "       [ 5,  6, 12],\n",
       "       [50, 16, 76],\n",
       "       [83, 62, 85],\n",
       "       [70, 88,  7],\n",
       "       [85, 27, 80],\n",
       "       [34, 79, 30],\n",
       "       [64, 48, 82],\n",
       "       [53, 25, 13],\n",
       "       [96, 28, 56],\n",
       "       [12, 53, 69],\n",
       "       [87, 27, 55],\n",
       "       [77,  9, 96],\n",
       "       [69, 80, 30],\n",
       "       [29,  4, 84],\n",
       "       [11, 34, 44],\n",
       "       [75, 88, 58],\n",
       "       [39,  5, 42],\n",
       "       [99, 57, 51],\n",
       "       [80, 51, 55],\n",
       "       [55, 41, 48],\n",
       "       [40, 39, 55],\n",
       "       [ 4, 56, 36],\n",
       "       [42, 43, 92],\n",
       "       [80, 93, 50],\n",
       "       [41, 55, 98],\n",
       "       [25,  6, 38],\n",
       "       [85, 51, 81],\n",
       "       [40, 58, 99]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[86, 61, 79],\n",
       "       [59, 26, 28],\n",
       "       [39, 17, 95],\n",
       "       [35, 10, 52],\n",
       "       [ 1, 83, 10],\n",
       "       [45, 18, 64],\n",
       "       [ 1, 77, 71],\n",
       "       [54, 19, 41],\n",
       "       [79, 48, 87],\n",
       "       [62, 80, 60],\n",
       "       [82, 25, 11],\n",
       "       [53, 68, 23],\n",
       "       [62, 74, 17],\n",
       "       [79, 79, 81],\n",
       "       [53, 83, 49],\n",
       "       [ 1, 16, 77],\n",
       "       [75, 42, 91],\n",
       "       [ 8, 44,  7],\n",
       "       [50, 52, 61],\n",
       "       [36, 32, 58],\n",
       "       [80, 71, 10],\n",
       "       [36, 78, 15],\n",
       "       [ 9, 48, 85],\n",
       "       [51, 33, 91],\n",
       "       [74, 49, 77],\n",
       "       [35, 44, 18],\n",
       "       [24, 40, 57],\n",
       "       [17, 72, 42],\n",
       "       [ 2, 56, 46],\n",
       "       [37, 83, 86],\n",
       "       [18,  4, 76],\n",
       "       [25, 34, 27],\n",
       "       [54, 16, 36],\n",
       "       [57, 38, 38],\n",
       "       [65, 68, 13],\n",
       "       [ 2, 70, 35],\n",
       "       [50, 53, 29],\n",
       "       [62, 19, 17],\n",
       "       [38, 58, 81],\n",
       "       [28, 76, 52],\n",
       "       [40, 95, 79],\n",
       "       [ 7, 69, 65],\n",
       "       [40, 22, 85],\n",
       "       [55,  4, 81],\n",
       "       [83, 80, 25],\n",
       "       [46,  4, 37],\n",
       "       [50, 74, 71],\n",
       "       [97, 35, 94],\n",
       "       [88, 17, 64],\n",
       "       [66, 23, 41]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[28, 73, 73],\n",
       "       [32, 32, 79],\n",
       "       [ 9, 44, 42],\n",
       "       [73, 18, 12],\n",
       "       [48, 47, 41],\n",
       "       [61, 19, 83],\n",
       "       [48, 15, 19],\n",
       "       [24,  4, 79],\n",
       "       [55, 69, 49],\n",
       "       [26,  3, 17],\n",
       "       [24,  8, 58],\n",
       "       [47,  6, 42],\n",
       "       [61, 25, 51],\n",
       "       [91, 27, 63],\n",
       "       [67, 20, 76],\n",
       "       [56, 40, 25],\n",
       "       [51, 81, 94],\n",
       "       [88, 68, 37],\n",
       "       [72, 77, 65],\n",
       "       [10, 25, 67],\n",
       "       [83, 29, 53],\n",
       "       [21,  1, 11],\n",
       "       [71, 74, 39],\n",
       "       [34, 79, 49],\n",
       "       [63, 38, 80],\n",
       "       [ 9, 84, 68],\n",
       "       [ 1, 95, 46],\n",
       "       [98, 59, 53],\n",
       "       [30, 31, 70],\n",
       "       [63, 96, 54],\n",
       "       [44, 27, 87],\n",
       "       [32,  6,  7],\n",
       "       [30, 82,  7],\n",
       "       [16, 46,  6],\n",
       "       [47,  3,  6],\n",
       "       [17, 67, 49],\n",
       "       [63, 40, 79],\n",
       "       [85, 10, 67],\n",
       "       [ 0, 11, 48],\n",
       "       [99, 21, 71],\n",
       "       [14, 14, 65],\n",
       "       [44, 66, 82],\n",
       "       [98, 57, 12],\n",
       "       [64, 43,  9],\n",
       "       [21, 36, 83],\n",
       "       [35,  1, 99],\n",
       "       [ 4, 44, 34],\n",
       "       [86, 46, 59],\n",
       "       [76, 18, 63],\n",
       "       [82, 21, 72]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[23, 90, 29],\n",
       "       [56, 27, 67],\n",
       "       [ 6, 74, 93],\n",
       "       [44, 64, 29],\n",
       "       [28, 96,  3],\n",
       "       [80, 36, 43],\n",
       "       [18, 61, 17],\n",
       "       [54, 11, 20],\n",
       "       [66, 87, 78],\n",
       "       [92, 56, 85],\n",
       "       [96, 45, 45],\n",
       "       [91, 10, 29],\n",
       "       [82, 28, 50],\n",
       "       [28, 76, 33],\n",
       "       [87, 58, 47],\n",
       "       [85, 58, 31],\n",
       "       [76, 60, 59],\n",
       "       [43, 14, 29],\n",
       "       [91, 37, 68],\n",
       "       [ 5, 92, 65],\n",
       "       [41, 21, 96],\n",
       "       [57,  9,  9],\n",
       "       [19, 45,  6],\n",
       "       [89, 54, 77],\n",
       "       [16, 50, 70],\n",
       "       [97, 61, 75],\n",
       "       [ 1, 47, 57],\n",
       "       [89, 16, 71],\n",
       "       [57,  0, 86],\n",
       "       [64, 89, 17],\n",
       "       [33, 64, 79],\n",
       "       [12, 42, 81],\n",
       "       [54, 21, 74],\n",
       "       [58, 97, 74],\n",
       "       [73, 93, 18],\n",
       "       [29, 47, 56],\n",
       "       [40, 49,  9],\n",
       "       [57, 80, 16],\n",
       "       [12, 69, 35],\n",
       "       [57, 33, 75],\n",
       "       [36, 77, 63],\n",
       "       [71, 59, 65],\n",
       "       [77, 89, 54],\n",
       "       [47, 99,  1],\n",
       "       [64, 44, 42],\n",
       "       [26, 85, 78],\n",
       "       [65, 42, 30],\n",
       "       [51, 63, 37],\n",
       "       [95, 25, 75],\n",
       "       [28,  1, 55]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "nd1 = np.random.randint(0,100,size=(50,3))\n",
    "nd2 = np.random.randint(0,100,size=(50,3))\n",
    "nd3 = np.random.randint(0,100,size=(50,3))\n",
    "nd4 = np.random.randint(0,100,size=(50,3))\n",
    "nd5 = np.random.randint(0,100,size=(50,3))\n",
    "nd6 = np.random.randint(0,100,size=(50,3))\n",
    "display(nd1,nd2,nd3,nd4,nd5,nd6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "2e2e888d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[14, 83, 52],\n",
       "       [60, 54, 37],\n",
       "       [32, 24, 62],\n",
       "       [55, 76, 12],\n",
       "       [80, 45, 72],\n",
       "       [24,  0, 38],\n",
       "       [49, 13, 28],\n",
       "       [91, 59, 11],\n",
       "       [90, 57, 59],\n",
       "       [67, 16, 67],\n",
       "       [29, 36, 94],\n",
       "       [55,  8, 25],\n",
       "       [82,  3, 99],\n",
       "       [57, 37, 37],\n",
       "       [ 7, 61, 92],\n",
       "       [29, 23, 34],\n",
       "       [17, 70, 84],\n",
       "       [25, 99, 84],\n",
       "       [28, 50, 36],\n",
       "       [91, 68, 37],\n",
       "       [10, 50, 37],\n",
       "       [45, 14, 61],\n",
       "       [58, 75, 70],\n",
       "       [28, 67,  8],\n",
       "       [ 0, 70, 69],\n",
       "       [17, 93, 13],\n",
       "       [21, 44, 18],\n",
       "       [ 0, 82, 41],\n",
       "       [83, 11, 10],\n",
       "       [71, 86, 18],\n",
       "       [ 0, 72, 34],\n",
       "       [20, 58, 53],\n",
       "       [41, 93, 90],\n",
       "       [90, 85, 29],\n",
       "       [11, 34, 57],\n",
       "       [55, 11, 90],\n",
       "       [24, 80, 34],\n",
       "       [52, 22, 92],\n",
       "       [15, 45,  1],\n",
       "       [89, 61, 37],\n",
       "       [47, 82, 20],\n",
       "       [44, 17, 94],\n",
       "       [50, 37, 52],\n",
       "       [15, 13, 49],\n",
       "       [ 6, 29, 13],\n",
       "       [74,  2, 62],\n",
       "       [93,  3, 52],\n",
       "       [64, 99, 91],\n",
       "       [72, 28, 10],\n",
       "       [95, 21, 55],\n",
       "       [14, 73, 24],\n",
       "       [81, 95, 65],\n",
       "       [82, 19, 18],\n",
       "       [18, 89, 90],\n",
       "       [99, 42, 56],\n",
       "       [41,  7, 10],\n",
       "       [64, 26, 28],\n",
       "       [13,  6,  9],\n",
       "       [55, 62, 93],\n",
       "       [91, 34,  5],\n",
       "       [19, 85, 97],\n",
       "       [99, 36, 61],\n",
       "       [48, 66, 66],\n",
       "       [71, 96, 70],\n",
       "       [62, 46, 39],\n",
       "       [11, 10, 48],\n",
       "       [69, 80, 61],\n",
       "       [67, 73, 76],\n",
       "       [74,  6, 34],\n",
       "       [70, 86, 73],\n",
       "       [36, 42, 41],\n",
       "       [28, 13, 76],\n",
       "       [36, 32, 73],\n",
       "       [ 2, 44, 70],\n",
       "       [73, 14, 98],\n",
       "       [31, 31,  1],\n",
       "       [89, 74, 12],\n",
       "       [11, 64, 27],\n",
       "       [35, 66, 87],\n",
       "       [49, 38, 50],\n",
       "       [61, 79, 34],\n",
       "       [30,  4, 13],\n",
       "       [87,  5, 46],\n",
       "       [83, 78, 85],\n",
       "       [22, 85, 25],\n",
       "       [32, 84, 91],\n",
       "       [ 4, 34, 36],\n",
       "       [95, 44, 33],\n",
       "       [27, 61, 18],\n",
       "       [98, 79, 15],\n",
       "       [69, 72, 23],\n",
       "       [36, 40, 11],\n",
       "       [85, 49, 82],\n",
       "       [ 8, 89, 44],\n",
       "       [20, 16, 92],\n",
       "       [ 1, 66, 94],\n",
       "       [54, 70, 40],\n",
       "       [50, 90, 24],\n",
       "       [44, 14, 37],\n",
       "       [20, 53, 66],\n",
       "       [98, 43, 94],\n",
       "       [57, 85, 46],\n",
       "       [75, 87, 26],\n",
       "       [84,  2, 10],\n",
       "       [21, 96, 78],\n",
       "       [62, 50, 97],\n",
       "       [59, 94, 43],\n",
       "       [84, 93, 70],\n",
       "       [17, 73, 37],\n",
       "       [ 9, 45, 26],\n",
       "       [40, 31,  1],\n",
       "       [ 0,  7, 55],\n",
       "       [49,  8, 65],\n",
       "       [13, 22, 73],\n",
       "       [35, 62, 25],\n",
       "       [49, 60, 41],\n",
       "       [49,  5, 72],\n",
       "       [45, 82, 75],\n",
       "       [ 6, 33, 54],\n",
       "       [96, 17, 44],\n",
       "       [ 4, 20, 78],\n",
       "       [88, 53, 99],\n",
       "       [ 5,  6, 12],\n",
       "       [50, 16, 76],\n",
       "       [83, 62, 85],\n",
       "       [70, 88,  7],\n",
       "       [85, 27, 80],\n",
       "       [34, 79, 30],\n",
       "       [64, 48, 82],\n",
       "       [53, 25, 13],\n",
       "       [96, 28, 56],\n",
       "       [12, 53, 69],\n",
       "       [87, 27, 55],\n",
       "       [77,  9, 96],\n",
       "       [69, 80, 30],\n",
       "       [29,  4, 84],\n",
       "       [11, 34, 44],\n",
       "       [75, 88, 58],\n",
       "       [39,  5, 42],\n",
       "       [99, 57, 51],\n",
       "       [80, 51, 55],\n",
       "       [55, 41, 48],\n",
       "       [40, 39, 55],\n",
       "       [ 4, 56, 36],\n",
       "       [42, 43, 92],\n",
       "       [80, 93, 50],\n",
       "       [41, 55, 98],\n",
       "       [25,  6, 38],\n",
       "       [85, 51, 81],\n",
       "       [40, 58, 99],\n",
       "       [86, 61, 79],\n",
       "       [59, 26, 28],\n",
       "       [39, 17, 95],\n",
       "       [35, 10, 52],\n",
       "       [ 1, 83, 10],\n",
       "       [45, 18, 64],\n",
       "       [ 1, 77, 71],\n",
       "       [54, 19, 41],\n",
       "       [79, 48, 87],\n",
       "       [62, 80, 60],\n",
       "       [82, 25, 11],\n",
       "       [53, 68, 23],\n",
       "       [62, 74, 17],\n",
       "       [79, 79, 81],\n",
       "       [53, 83, 49],\n",
       "       [ 1, 16, 77],\n",
       "       [75, 42, 91],\n",
       "       [ 8, 44,  7],\n",
       "       [50, 52, 61],\n",
       "       [36, 32, 58],\n",
       "       [80, 71, 10],\n",
       "       [36, 78, 15],\n",
       "       [ 9, 48, 85],\n",
       "       [51, 33, 91],\n",
       "       [74, 49, 77],\n",
       "       [35, 44, 18],\n",
       "       [24, 40, 57],\n",
       "       [17, 72, 42],\n",
       "       [ 2, 56, 46],\n",
       "       [37, 83, 86],\n",
       "       [18,  4, 76],\n",
       "       [25, 34, 27],\n",
       "       [54, 16, 36],\n",
       "       [57, 38, 38],\n",
       "       [65, 68, 13],\n",
       "       [ 2, 70, 35],\n",
       "       [50, 53, 29],\n",
       "       [62, 19, 17],\n",
       "       [38, 58, 81],\n",
       "       [28, 76, 52],\n",
       "       [40, 95, 79],\n",
       "       [ 7, 69, 65],\n",
       "       [40, 22, 85],\n",
       "       [55,  4, 81],\n",
       "       [83, 80, 25],\n",
       "       [46,  4, 37],\n",
       "       [50, 74, 71],\n",
       "       [97, 35, 94],\n",
       "       [88, 17, 64],\n",
       "       [66, 23, 41],\n",
       "       [28, 73, 73],\n",
       "       [32, 32, 79],\n",
       "       [ 9, 44, 42],\n",
       "       [73, 18, 12],\n",
       "       [48, 47, 41],\n",
       "       [61, 19, 83],\n",
       "       [48, 15, 19],\n",
       "       [24,  4, 79],\n",
       "       [55, 69, 49],\n",
       "       [26,  3, 17],\n",
       "       [24,  8, 58],\n",
       "       [47,  6, 42],\n",
       "       [61, 25, 51],\n",
       "       [91, 27, 63],\n",
       "       [67, 20, 76],\n",
       "       [56, 40, 25],\n",
       "       [51, 81, 94],\n",
       "       [88, 68, 37],\n",
       "       [72, 77, 65],\n",
       "       [10, 25, 67],\n",
       "       [83, 29, 53],\n",
       "       [21,  1, 11],\n",
       "       [71, 74, 39],\n",
       "       [34, 79, 49],\n",
       "       [63, 38, 80],\n",
       "       [ 9, 84, 68],\n",
       "       [ 1, 95, 46],\n",
       "       [98, 59, 53],\n",
       "       [30, 31, 70],\n",
       "       [63, 96, 54],\n",
       "       [44, 27, 87],\n",
       "       [32,  6,  7],\n",
       "       [30, 82,  7],\n",
       "       [16, 46,  6],\n",
       "       [47,  3,  6],\n",
       "       [17, 67, 49],\n",
       "       [63, 40, 79],\n",
       "       [85, 10, 67],\n",
       "       [ 0, 11, 48],\n",
       "       [99, 21, 71],\n",
       "       [14, 14, 65],\n",
       "       [44, 66, 82],\n",
       "       [98, 57, 12],\n",
       "       [64, 43,  9],\n",
       "       [21, 36, 83],\n",
       "       [35,  1, 99],\n",
       "       [ 4, 44, 34],\n",
       "       [86, 46, 59],\n",
       "       [76, 18, 63],\n",
       "       [82, 21, 72],\n",
       "       [23, 90, 29],\n",
       "       [56, 27, 67],\n",
       "       [ 6, 74, 93],\n",
       "       [44, 64, 29],\n",
       "       [28, 96,  3],\n",
       "       [80, 36, 43],\n",
       "       [18, 61, 17],\n",
       "       [54, 11, 20],\n",
       "       [66, 87, 78],\n",
       "       [92, 56, 85],\n",
       "       [96, 45, 45],\n",
       "       [91, 10, 29],\n",
       "       [82, 28, 50],\n",
       "       [28, 76, 33],\n",
       "       [87, 58, 47],\n",
       "       [85, 58, 31],\n",
       "       [76, 60, 59],\n",
       "       [43, 14, 29],\n",
       "       [91, 37, 68],\n",
       "       [ 5, 92, 65],\n",
       "       [41, 21, 96],\n",
       "       [57,  9,  9],\n",
       "       [19, 45,  6],\n",
       "       [89, 54, 77],\n",
       "       [16, 50, 70],\n",
       "       [97, 61, 75],\n",
       "       [ 1, 47, 57],\n",
       "       [89, 16, 71],\n",
       "       [57,  0, 86],\n",
       "       [64, 89, 17],\n",
       "       [33, 64, 79],\n",
       "       [12, 42, 81],\n",
       "       [54, 21, 74],\n",
       "       [58, 97, 74],\n",
       "       [73, 93, 18],\n",
       "       [29, 47, 56],\n",
       "       [40, 49,  9],\n",
       "       [57, 80, 16],\n",
       "       [12, 69, 35],\n",
       "       [57, 33, 75],\n",
       "       [36, 77, 63],\n",
       "       [71, 59, 65],\n",
       "       [77, 89, 54],\n",
       "       [47, 99,  1],\n",
       "       [64, 44, 42],\n",
       "       [26, 85, 78],\n",
       "       [65, 42, 30],\n",
       "       [51, 63, 37],\n",
       "       [95, 25, 75],\n",
       "       [28,  1, 55]])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 将六个班的考试成绩进行合并\n",
    "score = np.concatenate([nd1,nd2,nd3,nd4,nd5,nd6])\n",
    "score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "9a4645fd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0]])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex =np.random.randint(0,2,size=(300,1))\n",
    "sex"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "eea05e09",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1, 14, 83, 52],\n",
       "       [ 0, 60, 54, 37],\n",
       "       [ 1, 32, 24, 62],\n",
       "       ...,\n",
       "       [ 0, 51, 63, 37],\n",
       "       [ 0, 95, 25, 75],\n",
       "       [ 0, 28,  1, 55]])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 水平方向的堆叠，使用hstake\n",
    "data = np.hstack([sex,score])\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "60a2ae94",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0, 60, 54, 37],\n",
       "       [ 0, 24,  0, 38],\n",
       "       [ 0, 49, 13, 28],\n",
       "       [ 0, 29, 36, 94],\n",
       "       [ 0, 82,  3, 99],\n",
       "       [ 0, 57, 37, 37],\n",
       "       [ 0, 17, 70, 84],\n",
       "       [ 0, 25, 99, 84],\n",
       "       [ 0, 28, 50, 36],\n",
       "       [ 0, 91, 68, 37],\n",
       "       [ 0, 10, 50, 37],\n",
       "       [ 0, 45, 14, 61],\n",
       "       [ 0, 58, 75, 70],\n",
       "       [ 0,  0, 70, 69],\n",
       "       [ 0, 17, 93, 13],\n",
       "       [ 0,  0, 82, 41],\n",
       "       [ 0, 71, 86, 18],\n",
       "       [ 0, 24, 80, 34],\n",
       "       [ 0, 15, 45,  1],\n",
       "       [ 0, 89, 61, 37],\n",
       "       [ 0, 47, 82, 20],\n",
       "       [ 0, 15, 13, 49],\n",
       "       [ 0, 74,  2, 62],\n",
       "       [ 0, 93,  3, 52],\n",
       "       [ 0, 72, 28, 10],\n",
       "       [ 0, 95, 21, 55],\n",
       "       [ 0, 81, 95, 65],\n",
       "       [ 0, 82, 19, 18],\n",
       "       [ 0, 18, 89, 90],\n",
       "       [ 0, 41,  7, 10],\n",
       "       [ 0, 64, 26, 28],\n",
       "       [ 0, 13,  6,  9],\n",
       "       [ 0, 55, 62, 93],\n",
       "       [ 0, 19, 85, 97],\n",
       "       [ 0, 48, 66, 66],\n",
       "       [ 0, 69, 80, 61],\n",
       "       [ 0, 67, 73, 76],\n",
       "       [ 0, 74,  6, 34],\n",
       "       [ 0, 36, 42, 41],\n",
       "       [ 0, 28, 13, 76],\n",
       "       [ 0, 36, 32, 73],\n",
       "       [ 0, 73, 14, 98],\n",
       "       [ 0, 31, 31,  1],\n",
       "       [ 0, 89, 74, 12],\n",
       "       [ 0, 49, 38, 50],\n",
       "       [ 0, 61, 79, 34],\n",
       "       [ 0, 30,  4, 13],\n",
       "       [ 0, 87,  5, 46],\n",
       "       [ 0, 32, 84, 91],\n",
       "       [ 0, 69, 72, 23],\n",
       "       [ 0, 85, 49, 82],\n",
       "       [ 0,  8, 89, 44],\n",
       "       [ 0,  1, 66, 94],\n",
       "       [ 0, 54, 70, 40],\n",
       "       [ 0, 50, 90, 24],\n",
       "       [ 0, 44, 14, 37],\n",
       "       [ 0, 57, 85, 46],\n",
       "       [ 0, 75, 87, 26],\n",
       "       [ 0, 59, 94, 43],\n",
       "       [ 0,  9, 45, 26],\n",
       "       [ 0, 40, 31,  1],\n",
       "       [ 0,  0,  7, 55],\n",
       "       [ 0, 13, 22, 73],\n",
       "       [ 0, 35, 62, 25],\n",
       "       [ 0,  4, 20, 78],\n",
       "       [ 0, 88, 53, 99],\n",
       "       [ 0,  5,  6, 12],\n",
       "       [ 0, 64, 48, 82],\n",
       "       [ 0, 53, 25, 13],\n",
       "       [ 0, 96, 28, 56],\n",
       "       [ 0, 12, 53, 69],\n",
       "       [ 0, 87, 27, 55],\n",
       "       [ 0, 77,  9, 96],\n",
       "       [ 0, 11, 34, 44],\n",
       "       [ 0, 55, 41, 48],\n",
       "       [ 0, 40, 39, 55],\n",
       "       [ 0, 42, 43, 92],\n",
       "       [ 0, 25,  6, 38],\n",
       "       [ 0, 40, 58, 99],\n",
       "       [ 0, 86, 61, 79],\n",
       "       [ 0, 45, 18, 64],\n",
       "       [ 0,  1, 77, 71],\n",
       "       [ 0, 54, 19, 41],\n",
       "       [ 0, 79, 48, 87],\n",
       "       [ 0, 62, 80, 60],\n",
       "       [ 0, 79, 79, 81],\n",
       "       [ 0, 53, 83, 49],\n",
       "       [ 0,  1, 16, 77],\n",
       "       [ 0, 75, 42, 91],\n",
       "       [ 0, 36, 32, 58],\n",
       "       [ 0, 80, 71, 10],\n",
       "       [ 0,  9, 48, 85],\n",
       "       [ 0, 50, 53, 29],\n",
       "       [ 0, 40, 95, 79],\n",
       "       [ 0,  7, 69, 65],\n",
       "       [ 0, 46,  4, 37],\n",
       "       [ 0, 50, 74, 71],\n",
       "       [ 0, 97, 35, 94],\n",
       "       [ 0, 66, 23, 41],\n",
       "       [ 0, 48, 47, 41],\n",
       "       [ 0, 61, 19, 83],\n",
       "       [ 0, 48, 15, 19],\n",
       "       [ 0, 24,  4, 79],\n",
       "       [ 0, 26,  3, 17],\n",
       "       [ 0, 24,  8, 58],\n",
       "       [ 0, 47,  6, 42],\n",
       "       [ 0, 88, 68, 37],\n",
       "       [ 0, 71, 74, 39],\n",
       "       [ 0, 63, 38, 80],\n",
       "       [ 0, 30, 31, 70],\n",
       "       [ 0, 44, 27, 87],\n",
       "       [ 0, 16, 46,  6],\n",
       "       [ 0, 63, 40, 79],\n",
       "       [ 0, 85, 10, 67],\n",
       "       [ 0,  0, 11, 48],\n",
       "       [ 0, 44, 66, 82],\n",
       "       [ 0, 35,  1, 99],\n",
       "       [ 0, 82, 21, 72],\n",
       "       [ 0,  6, 74, 93],\n",
       "       [ 0, 44, 64, 29],\n",
       "       [ 0, 28, 96,  3],\n",
       "       [ 0, 80, 36, 43],\n",
       "       [ 0, 54, 11, 20],\n",
       "       [ 0, 92, 56, 85],\n",
       "       [ 0, 96, 45, 45],\n",
       "       [ 0, 91, 10, 29],\n",
       "       [ 0, 82, 28, 50],\n",
       "       [ 0, 85, 58, 31],\n",
       "       [ 0, 76, 60, 59],\n",
       "       [ 0, 43, 14, 29],\n",
       "       [ 0, 91, 37, 68],\n",
       "       [ 0, 41, 21, 96],\n",
       "       [ 0, 57,  9,  9],\n",
       "       [ 0, 19, 45,  6],\n",
       "       [ 0, 89, 54, 77],\n",
       "       [ 0, 97, 61, 75],\n",
       "       [ 0, 64, 89, 17],\n",
       "       [ 0, 54, 21, 74],\n",
       "       [ 0, 58, 97, 74],\n",
       "       [ 0, 29, 47, 56],\n",
       "       [ 0, 40, 49,  9],\n",
       "       [ 0, 57, 33, 75],\n",
       "       [ 0, 36, 77, 63],\n",
       "       [ 0, 71, 59, 65],\n",
       "       [ 0, 77, 89, 54],\n",
       "       [ 0, 51, 63, 37],\n",
       "       [ 0, 95, 25, 75],\n",
       "       [ 0, 28,  1, 55]])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 男生为cond1\n",
    "cond1 = data[:,0]==0\n",
    "data[cond1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "b708f543",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1, 14, 83, 52],\n",
       "       [ 1, 32, 24, 62],\n",
       "       [ 1, 55, 76, 12],\n",
       "       [ 1, 80, 45, 72],\n",
       "       [ 1, 91, 59, 11],\n",
       "       [ 1, 90, 57, 59],\n",
       "       [ 1, 67, 16, 67],\n",
       "       [ 1, 55,  8, 25],\n",
       "       [ 1,  7, 61, 92],\n",
       "       [ 1, 29, 23, 34],\n",
       "       [ 1, 28, 67,  8],\n",
       "       [ 1, 21, 44, 18],\n",
       "       [ 1, 83, 11, 10],\n",
       "       [ 1,  0, 72, 34],\n",
       "       [ 1, 20, 58, 53],\n",
       "       [ 1, 41, 93, 90],\n",
       "       [ 1, 90, 85, 29],\n",
       "       [ 1, 11, 34, 57],\n",
       "       [ 1, 55, 11, 90],\n",
       "       [ 1, 52, 22, 92],\n",
       "       [ 1, 44, 17, 94],\n",
       "       [ 1, 50, 37, 52],\n",
       "       [ 1,  6, 29, 13],\n",
       "       [ 1, 64, 99, 91],\n",
       "       [ 1, 14, 73, 24],\n",
       "       [ 1, 99, 42, 56],\n",
       "       [ 1, 91, 34,  5],\n",
       "       [ 1, 99, 36, 61],\n",
       "       [ 1, 71, 96, 70],\n",
       "       [ 1, 62, 46, 39],\n",
       "       [ 1, 11, 10, 48],\n",
       "       [ 1, 70, 86, 73],\n",
       "       [ 1,  2, 44, 70],\n",
       "       [ 1, 11, 64, 27],\n",
       "       [ 1, 35, 66, 87],\n",
       "       [ 1, 83, 78, 85],\n",
       "       [ 1, 22, 85, 25],\n",
       "       [ 1,  4, 34, 36],\n",
       "       [ 1, 95, 44, 33],\n",
       "       [ 1, 27, 61, 18],\n",
       "       [ 1, 98, 79, 15],\n",
       "       [ 1, 36, 40, 11],\n",
       "       [ 1, 20, 16, 92],\n",
       "       [ 1, 20, 53, 66],\n",
       "       [ 1, 98, 43, 94],\n",
       "       [ 1, 84,  2, 10],\n",
       "       [ 1, 21, 96, 78],\n",
       "       [ 1, 62, 50, 97],\n",
       "       [ 1, 84, 93, 70],\n",
       "       [ 1, 17, 73, 37],\n",
       "       [ 1, 49,  8, 65],\n",
       "       [ 1, 49, 60, 41],\n",
       "       [ 1, 49,  5, 72],\n",
       "       [ 1, 45, 82, 75],\n",
       "       [ 1,  6, 33, 54],\n",
       "       [ 1, 96, 17, 44],\n",
       "       [ 1, 50, 16, 76],\n",
       "       [ 1, 83, 62, 85],\n",
       "       [ 1, 70, 88,  7],\n",
       "       [ 1, 85, 27, 80],\n",
       "       [ 1, 34, 79, 30],\n",
       "       [ 1, 69, 80, 30],\n",
       "       [ 1, 29,  4, 84],\n",
       "       [ 1, 75, 88, 58],\n",
       "       [ 1, 39,  5, 42],\n",
       "       [ 1, 99, 57, 51],\n",
       "       [ 1, 80, 51, 55],\n",
       "       [ 1,  4, 56, 36],\n",
       "       [ 1, 80, 93, 50],\n",
       "       [ 1, 41, 55, 98],\n",
       "       [ 1, 85, 51, 81],\n",
       "       [ 1, 59, 26, 28],\n",
       "       [ 1, 39, 17, 95],\n",
       "       [ 1, 35, 10, 52],\n",
       "       [ 1,  1, 83, 10],\n",
       "       [ 1, 82, 25, 11],\n",
       "       [ 1, 53, 68, 23],\n",
       "       [ 1, 62, 74, 17],\n",
       "       [ 1,  8, 44,  7],\n",
       "       [ 1, 50, 52, 61],\n",
       "       [ 1, 36, 78, 15],\n",
       "       [ 1, 51, 33, 91],\n",
       "       [ 1, 74, 49, 77],\n",
       "       [ 1, 35, 44, 18],\n",
       "       [ 1, 24, 40, 57],\n",
       "       [ 1, 17, 72, 42],\n",
       "       [ 1,  2, 56, 46],\n",
       "       [ 1, 37, 83, 86],\n",
       "       [ 1, 18,  4, 76],\n",
       "       [ 1, 25, 34, 27],\n",
       "       [ 1, 54, 16, 36],\n",
       "       [ 1, 57, 38, 38],\n",
       "       [ 1, 65, 68, 13],\n",
       "       [ 1,  2, 70, 35],\n",
       "       [ 1, 62, 19, 17],\n",
       "       [ 1, 38, 58, 81],\n",
       "       [ 1, 28, 76, 52],\n",
       "       [ 1, 40, 22, 85],\n",
       "       [ 1, 55,  4, 81],\n",
       "       [ 1, 83, 80, 25],\n",
       "       [ 1, 88, 17, 64],\n",
       "       [ 1, 28, 73, 73],\n",
       "       [ 1, 32, 32, 79],\n",
       "       [ 1,  9, 44, 42],\n",
       "       [ 1, 73, 18, 12],\n",
       "       [ 1, 55, 69, 49],\n",
       "       [ 1, 61, 25, 51],\n",
       "       [ 1, 91, 27, 63],\n",
       "       [ 1, 67, 20, 76],\n",
       "       [ 1, 56, 40, 25],\n",
       "       [ 1, 51, 81, 94],\n",
       "       [ 1, 72, 77, 65],\n",
       "       [ 1, 10, 25, 67],\n",
       "       [ 1, 83, 29, 53],\n",
       "       [ 1, 21,  1, 11],\n",
       "       [ 1, 34, 79, 49],\n",
       "       [ 1,  9, 84, 68],\n",
       "       [ 1,  1, 95, 46],\n",
       "       [ 1, 98, 59, 53],\n",
       "       [ 1, 63, 96, 54],\n",
       "       [ 1, 32,  6,  7],\n",
       "       [ 1, 30, 82,  7],\n",
       "       [ 1, 47,  3,  6],\n",
       "       [ 1, 17, 67, 49],\n",
       "       [ 1, 99, 21, 71],\n",
       "       [ 1, 14, 14, 65],\n",
       "       [ 1, 98, 57, 12],\n",
       "       [ 1, 64, 43,  9],\n",
       "       [ 1, 21, 36, 83],\n",
       "       [ 1,  4, 44, 34],\n",
       "       [ 1, 86, 46, 59],\n",
       "       [ 1, 76, 18, 63],\n",
       "       [ 1, 23, 90, 29],\n",
       "       [ 1, 56, 27, 67],\n",
       "       [ 1, 18, 61, 17],\n",
       "       [ 1, 66, 87, 78],\n",
       "       [ 1, 28, 76, 33],\n",
       "       [ 1, 87, 58, 47],\n",
       "       [ 1,  5, 92, 65],\n",
       "       [ 1, 16, 50, 70],\n",
       "       [ 1,  1, 47, 57],\n",
       "       [ 1, 89, 16, 71],\n",
       "       [ 1, 57,  0, 86],\n",
       "       [ 1, 33, 64, 79],\n",
       "       [ 1, 12, 42, 81],\n",
       "       [ 1, 73, 93, 18],\n",
       "       [ 1, 57, 80, 16],\n",
       "       [ 1, 12, 69, 35],\n",
       "       [ 1, 47, 99,  1],\n",
       "       [ 1, 64, 44, 42],\n",
       "       [ 1, 26, 85, 78],\n",
       "       [ 1, 65, 42, 30]])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 女生为cond2\n",
    "cond2 = data[:,0]==1\n",
    "data[cond2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "0ffb7171",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([97, 99, 99])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#男生各科成绩的最大值，最小值，平均值，中位数，标准差\n",
    "data[cond1][:,[1,2,3]].max(axis=0)     # 最大值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1eca7e12",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 0, 1])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[cond1][:,[1,2,3]].min(axis=0)    # 最小值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "68567135",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([50.09459459, 44.79054054, 52.93918919])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[cond1][:,[1,2,3]].mean(axis=0)     # 平均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a813b033",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([50. , 45. , 54.5])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.median(data[cond1][:,[1,2,3]], axis=0)    # 中位数。中位数要注意是模块的函数，而不是对象的"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "2e7ed35a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([27.57234657, 28.64584621, 27.34420892])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[cond1][:,[1,2,3]].std(axis=0)      # 标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "ed0de064",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([99, 99, 98])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 女生各科成绩的最大值，最小值，平均值，中位数，标准差\n",
    "data[cond2][:,[1,2,3]].max(axis=0)    # 最大值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "519fdf7c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 0, 1])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[cond2][:,[1,2,3]].min(axis=0)    # 最小值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "c5db5dfc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([47.73026316, 49.90131579, 50.125     ])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[cond2][:,[1,2,3]].mean(axis=0)    # 平均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "bff53be8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([49. , 49.5, 52. ])"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.median(data[cond2][:,[1,2,3]],axis=0)    # 中位数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "a4c6e2c5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([29.28781191, 27.70349585, 27.07429168])"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[cond2][:,[1,2,3]].std(axis=0)     # 标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d4998787",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
